﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using TracNghiemTinHocDaiCuong.Common;
using TracNghiemTinHocDaiCuong.ThucThe;
using TracNghiemTinHocDaiCuong.BIZ;

namespace TracNghiemTinHocDaiCuong
{
    public partial class Profile : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Object id = Session["idNguoiDung"];
            if (id == null)
                Response.Redirect("DangNhap.aspx");
            else
            {
                int idNguoiDung = Methods.ConvertNumber(Session["idNguoiDung"].ToString());
                NguoiDung nguoiDung = NguoiDungBIZ.TimKiemTheoId(idNguoiDung);
                lblHoVaTen.Text = nguoiDung.HoVaTen;
                lblNgaySinh.Text = nguoiDung.NgaySinh.Day + "/" + nguoiDung.NgaySinh.Month + "/" +
                    nguoiDung.NgaySinh.Year;
                lblGioiTinh.Text = nguoiDung.GioiTinh;
                lblDienThoai.Text = nguoiDung.DienThoai;
                lblDiaChi.Text = nguoiDung.DiaChi;
                lblNgayDangKi.Text = nguoiDung.NgayDangKi.Day + "/" + nguoiDung.NgayDangKi.Month + "/" +
                    nguoiDung.NgayDangKi.Year;
                DataTable ketQua = BaiLamBIZ.KetQuaNguoiDung(idNguoiDung);
                if (ketQua == null)
                    lblKetQua.Text = "Không có hoạt động nào";
                else
                {
                    gvDiemCaNhan.DataSource = ketQua;
                    gvDiemCaNhan.DataBind();
                }
            }
        }

        protected void gvDiemCaNhan_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}